package com.xqls.service.impl;

import java.util.Date;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xqls.bean.FlowMeterBean;
import com.xqls.dal.dao.FlowMeterDao;
import com.xqls.dal.model.FlowMeter;
import com.xqls.dal.model.FlowMeterExample;
import com.xqls.service.FlowMeterService;
import com.xqls.util.ObjectUtil;

@Service
public class FlowMeterServiceImpl implements FlowMeterService {

	@Autowired private FlowMeterDao dao;
	
	@Override
	public List<Map<String, Object>> getFlowMetermap(Map<String, Object> map) {
		return dao.getAllmap(map);
	}
	@Override
	public boolean deleteFlowMeter(List<Integer> ids) {
		
        return dao.deleteList(ids);
		
	}
	
	@Override
	public boolean add(FlowMeterBean Flow) {
		return dao.addFlow((FlowMeter)ObjectUtil.transfer(Flow, FlowMeter.class));
	}
	
	@Override
	public boolean update(FlowMeterBean Flow) {
		return  dao.Update((FlowMeter)ObjectUtil.transfer(Flow, FlowMeter.class));
	}
	@Override
	public FlowMeterBean flowMeter(Integer key){
		return (FlowMeterBean) ObjectUtil.transfer(dao.selectByKey(key), FlowMeterBean.class);
	}
	@Override
	public List<FlowMeter> getList(){
		FlowMeterExample FlowMeter = new FlowMeterExample();
		return this.dao.queryByExample(FlowMeter);
	}
	
	@Override
	public FlowMeter selectByClose(String close,String deviceNo) {
		return dao.selectByClose(close,deviceNo);
	}
	
	@Override
	public List<FlowMeter> selectBySmonth(Date close, String deviceNo){
		return dao.selectBySmonth(close, deviceNo);
	}
	@Override
	public List<Map<String, Object>> selectBySmonth(Map<String, Object> map) {
		return dao.selectBySmonth(map);
	}
	@Override
	public List<Map<String, Object>> selectflowcost(Integer companyId, String  closeMonth){
		return dao.selectflowcost(companyId, closeMonth);
	}
	@Override
	public List<Map<String, Object>> getListByMap(Map<String, Object> map) {
		return this.dao.getListByMap(map);
	}
	@Override
	public FlowMeter selectByTime(String close, String deviceNo) {
		return dao.selectByTime(close,deviceNo);
	}
}
